package com.bosch.in.rtp1.ept.model.technical;

import java.util.ArrayList;
import java.util.List;

import com.bosch.in.rtp1.ept.constant.CommonConstants;

/**
 * Class encapsulates all search parameters, dynamic sql statement or search condition.
 * @author LIV1HC
 *
 */

public class Condition4FinishRecipe {
	/**
	 * Normal conditions
	 */
	private int year;
	private int month;
	private String partId;
	private String location;
	private String stage;
	private String eqpType;
	private String equipID;
	private int	priority;
	private int prodArea;
	private String customerName;
	private int factorType = -1;
	
	/**
	 * Parameter values, the number of values must be equal with 
	 * the number of place holder in search condition
	 */
	private List<Object> parameterValues;
	
	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public int getProdArea() {
		return prodArea;
	}

	public void setProdArea(int prodArea) {
		this.prodArea = prodArea;
	}

	public Condition4FinishRecipe()
	{
		this.year = CommonConstants.CURRENT_YEAR;
		this.month = CommonConstants.CURRENT_MONTH;
		this.factorType = -1;
	}
	
	public int getYear() {
		return year;
	}
	
	public void setYear(int year) {
		this.year = year;
	}
	
	public int getMonth() {
		return month;
	}
	
	public void setMonth(int month) {
		this.month = month;
	}
	
	public String getPartId() {
		if (this.partId == null)
		{
			return "";
		}
		return partId;
	}
	
	public void setPartId(String partId) {
		this.partId = partId;
	}
	
	public String getLocation() {
		if (this.location == null)
		{
			return "";
		}
		return location;
	}
	
	public void setLocation(String location) {
		this.location = location;
	}
	
	public String getStage() {
		if (this.stage == null)
		{
			return "";
		}
		return stage;
	}
	
	public void setStage(String stage) {
		this.stage = stage;
	}
	
	public String getEqpType() {
		if (this.eqpType == null)
		{
			return "";
		}
		return eqpType;
	}
	
	public void setEqpType(String eqpType) {
		this.eqpType = eqpType;
	}
	
	public String getEquipID() {
		if (this.equipID == null)
		{
			return "";
		}
		return equipID;
	}
	
	public void setEquipID(String equipID) {
		this.equipID = equipID;
	}

	public void setParameterValues(List<Object> parameterValues) {
		this.parameterValues = parameterValues;
	}

	public List<Object> getParameterValues() {
		return parameterValues;
	}
	
	public String getCustomerName() {
		if (this.customerName == null)
		{
			return "";
		}
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public int getFactorType() {
		return factorType;
	}

	public void setFactorType(int factorType) {
		this.factorType = factorType;
	}

	public void builParameterValuesList()
	{
		this.parameterValues = new ArrayList<Object>();
		this.parameterValues.add(this.getPriority());
		this.parameterValues.add(this.getProdArea());
		this.parameterValues.add(this.getYear());
		this.parameterValues.add(this.getPartId());
		this.parameterValues.add(this.getLocation());
		this.parameterValues.add(this.getStage());
		this.parameterValues.add(this.getEqpType());
		this.parameterValues.add(this.getEquipID());
		this.parameterValues.add(this.getCustomerName());
		//in case of this parameter list is used for loading recipes
		if (factorType>-1)
		{
			this.parameterValues.add(this.factorType);
			this.parameterValues.add(this.month);
		}
	}
	
	public void builParameterValuesList(int priority, int prodArea)
	{
		this.parameterValues = new ArrayList<Object>();
		this.parameterValues.add(priority);
		this.parameterValues.add(prodArea);
		this.parameterValues.add(this.year);
		this.parameterValues.add(this.partId);
		this.parameterValues.add(this.location);
		this.parameterValues.add(this.stage);
		this.parameterValues.add(this.eqpType);
		this.parameterValues.add(this.equipID);
		this.parameterValues.add(this.customerName);
	}
	
}
